//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IGuiComp.cpp>
///	@path	~/src/gui/
///	@date	2008/05/19
///	@desc	.

#include "config/config.h"

#include <time.h>

#include "gui/IGuiComp.h"

namespace xeres {

	IMPL_IOBJECT_INTERFACE( IGuiComp );

	// IGuiComp
	IGuiComp::IGuiComp( void )
	{
		static volatile uint32 s_global_id = 0;
		m_id = (uint32)atom_xchg_add( (volatile int*)&s_global_id , 1 );

		ActiveComponent();
	}
	// ~IGuiComp
	IGuiComp::~IGuiComp( void )
	{

	}
	// OnInput
	HandleInput IGuiComp::OnInput( Updater& updater )
	{
		if( updater.GetInput().IsKeyInput() )
			return OnKeyInput( updater );
		else
			return OnMouseInput( updater );
	}
	// ActiveComponent
	void IGuiComp::ActiveComponent( void )
	{
		m_activeId = (uint32)::GetTickCount();
	}
} // namespace xeres
